package com.lwz.iterator;

public class ConcereteIterator implements Iterator {
	
	private ConcereteAggreate concereteAggreate;
	
	private int index = -1;
	
	public ConcereteIterator(ConcereteAggreate concereteAggreate){
		this.concereteAggreate = concereteAggreate;
	}

	@Override
	public void first() {
		index = 0;
	}

	@Override
	public void next() {
		if(index<concereteAggreate.size()){
			index = index+1;
		}
	}

	@Override
	public boolean isDone() {
		if(index==concereteAggreate.size()){
			return true;
		}
		return false;
	}

	@Override
	public Object currentItem() {
		return concereteAggreate.get(index);
	}

}
